#include <gtkmm.h>
#include <iostream>
#include <fstream>
#include <string>
#include <stdio.h>
#include "TableroEditor.h"
#include "json/json.h"

class EditorNivel: public Gtk::Window {
protected:
	Glib::RefPtr<Gtk::Builder> builder;
	Gtk::SpinButton *spinfila;
	Gtk::SpinButton *spincol;
	Gtk::Fixed* wintablero;
	Gtk::ComboBox *combotipo;
	Gtk::ImageMenuItem *new_menu_item;
	Gtk::ImageMenuItem *open_menu_item;
	Gtk::ImageMenuItem *saveas_menu_item;
	Gtk::Window *windownew;
	Gtk::ComboBox *combocolor;
	Gtk::Label *label1;
	Gtk::SpinButton *spinprob;
	Gtk::ToggleButton *toggleselect;
	Gtk::SpinButton *spinnivel;
	Gtk::SpinButton *spinpuntaje;
	
	Gtk::FileChooserButton *filefondo;
	Gtk::FileChooserButton *filechoosersonido;
	
	Gtk::FileChooserDialog *filechooser;
	Gtk::FileChooserDialog *filechoosersave;
//ventana abrir
	Gtk::Button *buttonchooserabrir;
	Gtk::Button *buttonchoosercancelar;	
//ventana guardar
	Gtk::Button *buttonsave;
	Gtk::Button *buttoncancelarsave;	
//ventana nuevo
	Gtk::Button *buttonaceptar;
	Gtk::Button *buttoncancelar;

	TableroEditor *tablero;

public:
	EditorNivel(BaseObjectType* cobject,
			const Glib::RefPtr<Gtk::Builder>& refGlade); //constructor
			
protected:
	//signal handlers
	void on_combo_changed();
	void on_toggleselect_toggled();
	void on_spinprob_changed();
	
	void on_buttonaceptar_clicked();
	void on_buttoncancelar_clicked();
	
	void on_buttonchooserabrir_clicked();
	void on_buttonchoosercancelar_clicked();
	
	void on_buttoncancelarsave_clicked();
	void on_buttonsave_clicked();

	void on_open_menu_item_activate();
	void on_saveas_menu_item_activate();
	void on_new_menu_item_activate();
	
	void signal_file_fondo();
	
	void activarControlesEditor();
	
	//utiles
	std::string getNombreFile(std::string filename);
	std::string convertirIntaStr(int entero);
	
	~EditorNivel();
};
